package cn.bfay.lion.jingdong.job;

import cn.bfay.lion.jingdong.service.JdProductService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

/**
 * JdProductJobHandler.
 *
 * @author wangjiannan
 */
@Slf4j
@RequiredArgsConstructor
@Component
@JobHandler(value = "JdProductJobHandler")
public class JdProductJobHandler extends IJobHandler {
    private final JdProductService jdProductService;
    private final ThreadPoolTaskExecutor threadPoolTaskExecutor;

    @Override
    public ReturnT<String> execute(String param) {
        threadPoolTaskExecutor.execute(jdProductService::doExecute);
        return SUCCESS;
    }
}
